!function() {
    var t = require("../../05BFE3A3C6098CCF63D98BA434E9C3F4.js")(require("../../9D53CC23C6098CCFFB35A4246909C3F4.js"));
    getApp();
    let e = null;
    Page({
        data: {
            loadingDH: !0,
            cardCur: 0,
            swiperList: [],
            list: [],
            rand_data: [],
            hotList: [],
            keywords: [],
            tjBtn: "refresh",
            tjXz: "",
            kindex: ""
        },
        onLoad: function() {
            this.towerSwiper("swiperList"), this.getIndex(), wx.createInterstitialAd && (e = wx.createInterstitialAd({
                adUnitId: "adunit-b9abf64b40dddf8d"
            }), e.onLoad(() => {}), e.onError(t => {}), e.onClose(() => {}));
        },
        detail: function(t) {
            var e = t.currentTarget.dataset.id, a = t.currentTarget.dataset.item;
            1 == a && wx.navigateTo({
                url: "/pages/index/index?id=" + e
            }), 2 == a && wx.navigateTo({
                url: "/pages/gua/gua?id=" + e
            });
        },
        type: function(t) {
            var e = t.currentTarget.dataset.item;
            wx.navigateTo({
                url: "/pages/heji/heji?keywords=" + e
            });
        },
        selKey: function(t) {
            var e = t.currentTarget.dataset.index;
            wx.navigateTo({
                url: "/pages/heji/heji?keywords=" + this.data.keywords[e]
            });
        },
        shuaxin: function() {
            var e = this;
            e.setData({
                tjBtn: "loading2",
                tjXz: "iconfont-spin"
            }), t.default.postRequest("/api/Index/randData", {}, "加载中...", "loading", function(t) {
                e.setData({
                    tjBtn: "refresh",
                    tjXz: "",
                    rand_data: t.data.data
                });
            }, function(t) {
                wx.showToast({
                    title: "请求失败",
                    icon: "none",
                    duration: 3e3
                });
            });
        },
        onShow: function() {
            e && e.show().catch(t => {
                
            });
        },
        getIndex: function() {
            var e = this;
            t.default.postRequest("/api/Index/index", {}, "", "", function(t) {
                e.setData({
                    swiperList: t.data.data.banner,
                    list: t.data.data.list,
                    rand_data: t.data.data.rand_data,
                    hotList: t.data.data.hotList,
                    keywords: t.data.data.keywords,
                    loadingDH: !1
                }), wx.setStorageSync("home_keywords", t.data.data.keywords);
            }, function(t) {
                wx.showToast({
                    title: "请求失败",
                    icon: "none",
                    duration: 3e3
                });
            });
        },
        clickGong: function(t) {
            var e = t.currentTarget.dataset.index;
            wx.setStorageSync("type", e), wx.switchTab({
                url: "../index/index"
            });
        },
        DotStyle: function(t) {
            this.setData({
                DotStyle: t.detail.value
            });
        },
        cardSwiper: function(t) {
            this.setData({
                cardCur: t.detail.current
            });
        },
        towerSwiper: function(t) {
            for (var e = this.data[t], a = 0; a < e.length; a++) e[a].zIndex = parseInt(e.length / 2) + 1 - Math.abs(a - parseInt(e.length / 2)), 
            e[a].mLeft = a - parseInt(e.length / 2);
            this.setData({
                swiperList: e
            });
        },
        towerStart: function(t) {
            this.setData({
                towerStart: t.touches[0].pageX
            });
        },
        towerMove: function(t) {
            this.setData({
                direction: t.touches[0].pageX - this.data.towerStart > 0 ? "right" : "left"
            });
        },
        towerEnd: function(t) {
            var e = this.data.direction, a = this.data.swiperList;
            if ("right" == e) {
                for (var n = a[0].mLeft, i = a[0].zIndex, r = 1; r < a.length; r++) a[r - 1].mLeft = a[r].mLeft, 
                a[r - 1].zIndex = a[r].zIndex;
                a[a.length - 1].mLeft = n, a[a.length - 1].zIndex = i, this.setData({
                    swiperList: a
                });
            } else {
                for (var s = a[a.length - 1].mLeft, d = a[a.length - 1].zIndex, o = a.length - 1; o > 0; o--) a[o].mLeft = a[o - 1].mLeft, 
                a[o].zIndex = a[o - 1].zIndex;
                a[0].mLeft = s, a[0].zIndex = d, this.setData({
                    swiperList: a
                });
            }
        }
    });
}();